package cn.myzqu.start.rabbitmq.task;


import cn.myzqu.start.rabbitmq.producer.FanoutMsg;
import cn.myzqu.start.rabbitmq.producer.MsgProducer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


@Component
@Slf4j
public class SendTask {


    @Autowired
    private MsgProducer msgProducer;

    @Autowired
    private FanoutMsg fanoutMsg;

    //每隔1分钟执行一次
    @Scheduled(fixedRate = 1000 * 60)
    public void testKafka() {
        msgProducer.sendMsg("RabbitMQ");
        fanoutMsg.sendMsg("RabbitMQ FanoutMsg");
    }


}
